package com.example.tool.activtiy;

import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.example.tool.R;
import com.example.tool.activtiy.base.BaseActivity;
import com.example.tool.activtiy.recylerview.AdapterActivtiy;
import com.example.tool.adapter.CommonTextAdapter;
import com.example.tool.adapter.HomeRvAdapter;
import com.example.tool.listener.OnItemListener;
import com.example.tool.mvp.CommonPresent;

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import butterknife.BindView;

public class EventSlipActivity extends BaseActivity<CommonPresent> {
    @BindView(R.id.rv_home)
    RecyclerView recyclerView;
    @BindView(R.id.tv_title)
    TextView tvTitle;
    private LinearLayoutManager layoutManager;
    private CommonTextAdapter homeRvAdapter;
    private String[] strings = null;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_main;
    }

    @Override
    protected void initView() {
        strings = getResources().getStringArray(R.array.event_array);
        recyclerView = findViewById(R.id.rv_home);
        tvTitle = findViewById(R.id.tv_title);
        layoutManager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
        recyclerView.setLayoutManager(layoutManager);
        homeRvAdapter = new CommonTextAdapter(R.layout.font_item, Arrays.asList(strings), this);
        tvTitle.setText("事件滑动研究");
        recyclerView.setAdapter(homeRvAdapter);
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void initEvent() {
//        homeRvAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
//            @Override
//            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
//
//            }
//        });
        homeRvAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
            @Override
            public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
                switch (position) {
                    case 0:
                        startToActivity(EventSlipActivity.this, GestureActivity.class);
                        break;

                    case 1:
                        startToActivity(EventSlipActivity.this, EventActivity.class);
                        break;

                }
            }
        });
    }

    @Override
    protected CommonPresent createPresenter() {
        return null;
    }

    @Override
    protected void onResume() {
        super.onResume();

    }

}
